home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 176-200 / disk_185 / examples / pgtb / pgtb.zoo / tb.h < prev    next >
C/C++ Source or Header  |  1988-12-12  |  4KB  |  144 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2. /* |_o_o|\\   The Software Distillery                         */
  3. /* |. o.| ||  Made available for the Amiga development community         */
  4. /* | .    | ||   author:                           BBS:      */
  5. /* | o    | ||   John Mainwaring                     (919)-471-6436  */
  6. /* |  . |//                                     */
  7. /* ======                                     */
  8. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9.  
  10. /* global definitions for traceback dump utility */
  11.  
  12. #include "exec/types.h"
  13. #include "exec/memory.h"
  14. #include "proto/exec.h"
  15. #include "stdio.h"
  16. #include "string.h"
  17. #include "stdlib.h"
  18.  
  19. #define FATAL 20
  20.  
  21. /* bit flags for dump options */
  22. #define SYMFLG        1<<0
  23. #define FAILFLG     1<<1
  24. #define REGFLG        1<<2
  25. #define ENVFLG        1<<3
  26. #define STAKFLG     1<<4
  27. #define UDATFLG     1<<5
  28. #define FMEMFLG     1<<6
  29. #define TRACEFLG    1<<7
  30.  
  31. struct symbol_node {
  32.    struct symbol_node * sn_next;
  33.    long sn_memsize;
  34.    ULONG sn_value;
  35.    char sn_sym[4]; /* real length determined when allocated */
  36.    };
  37.  
  38. struct line_elem {
  39.    ULONG le_line;
  40.    ULONG le_off;
  41.    };
  42.  
  43. struct line_node {
  44.    struct line_node * ln_next;
  45.    ULONG ln_size;    /* byte size of this block            */
  46.    ULONG ln_offset;    /* offset into segment of this object file    */
  47.    ULONG ln_nsize;    /* length of name (in longwords)                */
  48.    char  ln_name[4];    /* name of object file lines belong to        */
  49.             /* a table of line_elem comes after full name    */
  50.    };
  51.  
  52. /* element of table of seglist descriptors */
  53. struct segment {
  54.    long addr;
  55.    long size;
  56.    struct symbol_node *symbols;
  57.    struct line_node *lines;
  58.    };
  59.  
  60. /* element of UDAT chain */
  61. struct udata {
  62.    struct udata *udptr;
  63.    long udsize;
  64.    long udat[1];  /* actual length of array given by udsize */
  65.    };
  66.  
  67. /* data structure to hold contents of PGTB traceback file */
  68. struct tbtemplate {
  69.    /* FAIL stuff */
  70.    long  gotfail;    /* found FAIL chunk        */
  71.    char *taskname;    /* name from task block     */
  72.    ULONG environ,    /* H/W environment        */
  73.      vbfreq,    /* Vertical Blank        */
  74.      psfreq,    /* Power Supply         */
  75.      starter,    /* 0 = WB else CLI        */
  76.      guru,        /* defined in alerts.h        */
  77.      segcount;    /* longword count        */
  78.    struct segment *segments; /* seglist         */
  79.    /* REGS stuff */
  80.    long  gotregs;    /* found REGS chunk        */
  81.    ULONG pc,        /* program counter        */
  82.      cc,        /* condition code reg        */
  83.      dregs[8],    /* D0-D7            */
  84.      aregs[8];    /* A0-A7            */
  85.    /* VERS stuff */
  86.    long  gotvers;    /* found VERS chunk        */
  87.    ULONG ver,        /* version of catch.o        */
  88.      rev;        /* revision of catch.o        */
  89.    char *filename;    /* name of catch.o        */
  90.    /* FMEM stuff */
  91.    long  gotfmem;    /* got FMEM chunk        */
  92.    ULONG memca,     /* available chip        */
  93.      memcm,     /* max chip            */
  94.      memcl,     /* largest chip         */
  95.      memfa,     /* available fast        */
  96.      memfm,     /* max fast            */
  97.      memfl;     /* largest fast         */
  98.    /* STAK stuff (pointer to data chain) */
  99.    ULONG staktop,    /* top of stack         */
  100.      stakptr,/* saved stack pointer         */
  101.      staklen,    /* bottom of stack        */
  102.      topseg,    /* bool top present        */
  103.      botseg,    /* bool bot present        */
  104.      seglen,    /* else entire size*/
  105.      stak[2048];    /* stack data, 8K bytes     */
  106.    /* UDAT stuff */
  107.    struct udata *udhead;
  108.    };
  109.  
  110. struct addrinfo {
  111.    long hunknum;
  112.    long offset;
  113.    char *name;
  114.    char *objname;
  115.    long line;
  116.    long lineoff;
  117.    };
  118.  
  119. /* templates for functions called from outside defining section */
  120.  
  121. /* defined in tb.c */
  122. int tidyproc(int);
  123.  
  124. /* defined in tbrutil.c */
  125. long getlong(FILE *);
  126. long forcegetlong(FILE *);
  127. void getblock(FILE *, ULONG *, long);
  128. ULONG getascii(FILE *, char **);
  129. void skiplong(FILE *, long);
  130.  
  131. /* defined in tbread.h */
  132. int  tbread(FILE *);
  133.  
  134. /* defined in tbsym.h */
  135. int  readsym(FILE *);
  136.  
  137. /* defined in tbdump.c */
  138. void tbdump(int);
  139.  
  140. /* defined in tbwutil.c */
  141. void hexdump(FILE *, unsigned char *, long, long);
  142. void longtoascii(ULONG, char *);
  143. int  locaddr(ULONG, struct addrinfo *);
  144.